home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: formatting integers
- Date: Sat, 30 Mar 96 21:39:56 GMT
- Organization: none
- Distribution: usa
- Message-ID: <828221996snz@genesis.demon.co.uk>
- References: <4jfmsh$lal@uwm.edu>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4jfmsh$lal@uwm.edu>
- gidwani@alpha1.csd.uwm.edu "Vinay K Gidwani" writes:
-
- >I am trying to format an integer that is left justified, length of 4 and
- >0 filled.
-
- That makes no sense. If it is left justified there is nowhere to zero fill.
- If printf zero filled to the right it would be printing the wring number
- so it can't do that.
-
- >
- >I tried the following %-0*%d and typed in the length of 4, but it gave me
- >the following output
-
- > 4.
- > When I try %0*d, then I get the following output.
- > 0004.
- > The length and the 0 filled in works but I cannot get it to left
- > justify.
-
- Give an example of the output you actually want.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-